import http from '../../http'
// 初始化数据
const initcategories = async (obj) => {
    let data = await http({
        method: 'GET',
        url: 'categories',
        params: obj
    })
    return data
}
// 添加
const addlist = async (obj) => {
    let data = await http({
        method: 'post',
        url: 'categories',
        data: obj
    })
    return data
}
// 修改回填
const updatahui = async (id) => {
    let data = await http({
        method: 'GET',
        url: `categories/${id}`,
    })
    return data
}
// 编辑提交分类
const updata = async (obj) => {
    let data = await http({
        method: 'put',
        url: `categories/${obj.cat_id}`,
        data: obj
    })
    return data
}
// 删除分类
const deleteitem = async (obj) => {
    let data = await http({
        method: 'delete',
        url: `categories/${obj.cat_id}`
    })
    return data
}
export {
    initcategories,
    addlist,
    updatahui,
    updata,
    deleteitem
}